<?php

namespace app\admin\model\activity;

use think\Model;

class Teacher extends Model
{
    // 表名
    protected $name = 'activity_teacher';
    
    // 自动写入时间戳字段
    protected $autoWriteTimestamp = 'int';

    // 定义时间戳字段名
    protected $createTime = 'createtime';
    protected $updateTime = 'updatetime';
    
    // 追加属性
    protected $append = [
        'nianji_text',
        'get_grade_text',
        'subject_text',
        'banben_text'
    ];
    

    
    public function getNianjiList()
    {
        return ['1' => __('Nianji 1'),'2' => __('Nianji 2'),'3' => __('Nianji 3'),'4' => __('Nianji 4'),'5' => __('Nianji 5'),'6' => __('Nianji 6')];
    }     

    public function getGetGradeList()
    {
        return ['1' => __('Get_grade 1'),'2' => __('Get_grade 2'),'3' => __('Get_grade 3'),'4' => __('Get_grade 4'),'5' => __('Get_grade 5'),'6' => __('Get_grade 6')];
    }     

    public function getSubjectList()
    {
        return ['1' => __('Subject 1'),'2' => __('Subject 2')];
    }     

    public function getBanbenList()
    {
        return ['1' => __('Banben 1'),'2' => __('Banben 2'),'3' => __('Banben 3'),'4' => __('Banben 4')];
    }     


    public function getNianjiTextAttr($value, $data)
    {        
        $value = $value ? $value : $data['nianji'];
        $list = $this->getNianjiList();
        return isset($list[$value]) ? $list[$value] : '';
    }


    public function getGetGradeTextAttr($value, $data)
    {        
        $value = $value ? $value : $data['get_grade'];
        $list = $this->getGetGradeList();
        return isset($list[$value]) ? $list[$value] : '';
    }


    public function getSubjectTextAttr($value, $data)
    {        
        $value = $value ? $value : $data['subject'];
        $list = $this->getSubjectList();
        return isset($list[$value]) ? $list[$value] : '';
    }


    public function getBanbenTextAttr($value, $data)
    {        
        $value = $value ? $value : $data['banben'];
        $list = $this->getBanbenList();
        return isset($list[$value]) ? $list[$value] : '';
    }




}
